import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.*;
import pojo.User;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class MybatisDemo01 {
    public static void main(String[] args) throws IOException {
        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");

        SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);
        SqlSession sqlSession = factory.openSession();
        List<User> userList = sqlSession.selectList("test.selectAll");

        sqlSession.close();
        for (User user : userList) {
            System.out.println(user);
        }
    }
}
